#include <iostream>
#include <unistd.h>
#include <signal.h>

int n = 0;
void handler(int sig)
{
    n = alarm(0);
    std::cout << n << std::endl;

}
int main()
{
    signal(14, handler);
    std::cout<<getpid()<<std::endl;
    alarm(10);
    n = alarm(8);
    while(1)
    {
        std::cout << n << std::endl;

        sleep(1);
    }
    std::cout<<getpid()<<std::endl;
    std::cout<<getpid()<<std::endl;
    std::cout<<getpid()<<std::endl;

}